The delegate type used to try and parse a string
Syntax
Visual Basic (Declaration) | |
---|
Public Delegate Function StringConverter.TryParseMethod(Of TYPE)( _
ByVal text As String, _
ByRef value As TYPE _
) As Boolean |
Parameters
- text
- value
Type Parameters
- TYPE
Example
Library/Library.Test/TestStringConvert.cs
C# | Copy Code |
---|
DateTime date = new DateTime(2000, 1,2,3,4,5,6);
string dt = date.ToString();
StringConverter c = new StringConverter();
Assert.AreNotEqual(dt, c.ToString(date));
c.Add<DateTime>(DateTime.TryParse, delegate(DateTime value) { return value.ToString(); });
Assert.AreEqual(dt, c.ToString(date)); |
VB.NET | Copy Code |
---|
Dim [date] As New DateTime(2000, 1, 2, 3, 4, 5, _
6)
Dim dt As String = [date].ToString()
Dim c As New StringConverter()
Assert.AreNotEqual(dt, c.ToString([date]))
c.Add(Of DateTime)(DateTime.TryParse, Function(value As DateTime) Do
Return value.ToString()
End Function)
Assert.AreEqual(dt, c.ToString([date])) |
Requirements
Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7
See Also